# _*_ coding:utf-8 _*_
from django.conf.urls import url, include
from api_1 import views
from rest_framework.routers import DefaultRouter
from rest_framework.urlpatterns import format_suffix_patterns
from api_1.views import ReviewViewset, UserViewSet, MovieViewset

# review_list = ReviewViewset.as_view({
# 	'get': 'list',
# 	'post': 'create'
# })
# review_detail = ReviewViewset.as_view({
# 	'get': "retrieve",
# 	'put': 'update',
# 	'patch':'partial_update',
# 	'delete': 'destroy'
# })
# user_list = UserViewSet.as_view({
# 	'get': 'list',
# })
# user_detail = UserViewSet.as_view({
# 	'get': 'retrieve'
# })
# urlpatterns = [
# 	url('^$', views.api_root),#api根
# 	url('^reviews/$', review_list,name='review-list'),
# 	url('^reviews/(?P<pk>[0-9]+)/$', review_detail,name='review-detail'),
# 	url('^users/$',user_list,name='user-list'),
# 	url('^users/(?P<pk>[0-9]+)/$',user_detail,name='user-detail'),
# ]
#
# urlpatterns = format_suffix_patterns(urlpatterns)

router = DefaultRouter()
router.register(r'reviews', ReviewViewset,base_name="reviews")
router.register(r'movies',MovieViewset,base_name='movies')
router.register(r'movie/comments',views.MCommentViewset,base_name='movie_comments')
router.register(r'review/comments',views.RCommentViewset,base_name='review_comments')
router.register(r'users', UserViewSet,base_name='users')

urlpatterns = [
	url(r'', include(router.urls)),
]